package org.now.ypos.core;

import java.time.LocalDateTime;
import java.util.Objects;
import java.util.StringJoiner;

/**
 * base dto
 *
 * @author wl
 * @since 2020.11.10
 */
public class BaseDto extends BaseObject {

    private static final long serialVersionUID = 1L;

    private Long id;

    private int deleted;
    private String remark;
    private Long createBy;
    private Long updateBy;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getDeleted() {
        return deleted;
    }

    public void setDeleted(int deleted) {
        this.deleted = deleted;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getCreateBy() {
        return createBy;
    }

    public void setCreateBy(Long createBy) {
        this.createBy = createBy;
    }

    public Long getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(Long updateBy) {
        this.updateBy = updateBy;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        BaseDto baseDto = (BaseDto) o;
        return deleted == baseDto.deleted &&
                Objects.equals(id, baseDto.id) &&
                Objects.equals(remark, baseDto.remark) &&
                Objects.equals(createBy, baseDto.createBy) &&
                Objects.equals(updateBy, baseDto.updateBy) &&
                Objects.equals(createTime, baseDto.createTime) &&
                Objects.equals(updateTime, baseDto.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, deleted, remark, createBy, updateBy, createTime, updateTime);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", BaseDto.class.getSimpleName() + "[", "]")
                .add("id=" + id)
                .add("deleted=" + deleted)
                .add("remark='" + remark + "'")
                .add("createBy=" + createBy)
                .add("updateBy=" + updateBy)
                .add("createTime=" + createTime)
                .add("updateTime=" + updateTime)
                .toString();
    }
}
